<template>
  <view class="content">
    <image class="logo" src="/static/logo.png" />
    <view class="text-area">
      <text class="title">{{ title }}</text>
      <text class="title">{{ testStore.count }}</text>
    </view>
    <view>
      <text v-for="item in testStore.items" :key="item">{{ item }}</text>
    </view>
    <fui-button type="success" @click="addItem">add</fui-button>
    <fui-button @click="navSub">跳转到分包测试页面</fui-button>
  </view>
</template>

<script setup lang="ts">
import { onLoad, onShow } from '@dcloudio/uni-app'
import { ref } from 'vue'
import { href } from '@/common/utils'
import { useTest } from '@/store/test'
const testStore = useTest()
const addItem = () => {
  testStore.addList(6)
}

const navSub = () => {
  href('/subPackages/test/pages/test')
}
import { get } from '../../common/httpRequest'
get(
  'http://www.baidu.com/dpc',
  {},
  {
    isForm: true,
  }
).then(
  res => {
    console.log(res)
  },
  err => console.log(err)
)
const title = ref('Hello')

onLoad(options => {
  console.log('页面初始化')
})
onShow(() => {
  console.log('页面出现时')
})
</script>

<style scoped lang="scss">
.content {
  display: flex;
  flex-direction: column;
  justify-content: center;

  .logo {
    height: 200rpx;
    width: 200rpx;
    margin-top: 200rpx;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 50rpx;
  }
}

.text-area {
  display: flex;
  justify-content: center;
}

.title {
  font-size: 36rpx;
  color: #8f8f94;
}
</style>
